<template>
  <div class="block text-center">
    <el-carousel height="45vh">
      <el-carousel-item v-for="item in datalist" :key="item">
        <el-image :src="item.url" fit="fill">
          <template #error>
            <div class="image-slot">
              <el-icon><icon-picture /></el-icon>
            </div>
          </template>
        </el-image>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>
<script setup>
import request from 'axios'
import { Picture as IconPicture } from '@element-plus/icons-vue'
var datalist = [
  { 'url': 'https://www.hexindev.fun/static/index/10001.jpg', 'to': '' },
  { 'url': 'https://www.hexindev.fun/static/index/10002.jpg', 'to': '' },
  { 'url': 'https://www.hexindev.fun/static/index/10002.png', 'to': '' },
  { 'url': 'https://www.hexindev.fun/static/index/10003.png', 'to': '' }
];
</script>
<style scoped>
.el-image {
  width: 100%;
  height: 100%
}

.demo-image__error .block {
  padding: 30px 0;
  text-align: center;
  border-right: solid 1px var(--el-border-color);
  display: inline-block;
  width: 49%;
  box-sizing: border-box;
  vertical-align: top;
}

.demo-image__error .demonstration {
  display: block;
  color: var(--el-text-color-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.demo-image__error .el-image {
  padding: 0 5px;
  max-width: 300px;
  max-height: 200px;
  width: 100%;
  height: 200px;
}

.demo-image__error .image-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background: var(--el-fill-color-light);
  color: var(--el-text-color-secondary);
  font-size: 30px;
}

.demo-image__error .image-slot .el-icon {
  font-size: 30px;
}
</style>